home *** CD-ROM | disk | FTP | other *** search
- unit Conj2;
- { PC Plus sample Delphi program. A simple French verb conjugator - mark 2 }
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls;
-
- type
- TForm1 = class(TForm)
- ListBox1: TListBox;
- Edit1: TEdit;
- Label1: TLabel;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.Button1Click(Sender: TObject);
- var { --- Declare 3 string variables --- }
- verb, { the verb specified by the user }
- verbStem, { the verb minus its 2-letter ending }
- verbEnd : string; { the 2-letter ending }
- begin
- verb := Edit1.Text;
- { check that the user has entered something... }
- if verb = '' then
- Caption := 'You must enter a verb!'
- else
- { BEGIN BLOCK # 1 - if verb is not '' }
- begin {... if so, then }
- { find the stem and the ending of the verb }
- verbStem := copy( verb, 1, length(verb)-2 );
- verbEnd := copy( verb, length(verb) -1, 2 );
- Caption := 'This is an ' + verbEnd + ' verb.';
- { if this isn't an ER verb, show error msg... }
- if LowerCase( verbEnd ) <> 'er' then
- Caption := 'You must enter an ER verb!'
- else
- { BEGIN BLOCK #2 - if this is an ER verb }
- begin {... otherwise, display verb conjugation }
- ListBox1.Items.Add('Je ' + verbStem + 'e');
- ListBox1.Items.Add('Tu ' + verbStem + 'es' );
- ListBox1.Items.Add('Il ' + verbStem + 'e' );
- ListBox1.Items.Add('Elle ' + verbStem + 'e' );
- ListBox1.Items.Add('Nous ' + verbStem + 'e' );
- ListBox1.Items.Add('Vous ' + verbStem + 'ez' );
- ListBox1.Items.Add('Ils ' + verbStem + 'ent');
- ListBox1.Items.Add('Elles ' + verbStem + 'ent');
- end;
- { END BLOCK #2 }
- end;
- { END BLOCK # 1 }
- end;
-
- end.
-